package com.leboncoin.bean;

import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@NamedQuery(name="findClassifiedBySearchText", 
        query="select classified from ClassifiedBean classified where classified.searchItemBean.searchText=:searchText")
@Table(name="classified")
public class ClassifiedBean implements Serializable {

	protected static final Logger logger = Logger.getLogger(ClassifiedBean.class.getName());	
	
	String title;
	Float price;
	@Id
	String link;
	String body;
	@Transient
	List<String> imageLinks;
	@Transient
	List<File> imageFiles;
	@ManyToOne
	@JoinColumn(name="searchitembean_searchtext")
	SearchItemBean searchItemBean; 
	
	public ClassifiedBean() {
		super();
		this.imageLinks = new ArrayList<String>();
		this.imageFiles = new ArrayList<File>();
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public Float getPrice() {
		return price;
	}
	public void setPrice(Float price) {
		this.price = price;
	}
	public String getLink() {
		return link;
	}
	public void setLink(String link) {
		this.link = link;
	}
	public String getBody() {
		return body;
	}
	public void setBody(String body) {
		this.body = body;
	}

	public List<String> getImageLinks() {
		return imageLinks;
	}
	public void setImageLinks(List<String> imageLinks) {
		this.imageLinks = imageLinks;
	}
	public List<File> getImageFiles() {
		return imageFiles;
	}
	public void setImageFiles(List<File> imageFiles) {
		this.imageFiles = imageFiles;
	}
	public SearchItemBean getSearchItemBean() {
		return searchItemBean;
	}
	public void setSearchItemBean(SearchItemBean searchItemBean) {
		this.searchItemBean = searchItemBean;
	}
	

}
